{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Using matplotlib backend: Qt5Agg\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "from mpl_toolkits.basemap import Basemap\n",
    "from matplotlib.patches import Polygon\n",
    "%matplotlib"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'm' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-2-e90df7436794>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mlen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mm\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mstates_info\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[0;31mNameError\u001b[0m: name 'm' is not defined"
     ]
    }
   ],
   "source": [
    "print(len(m.states_info))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2021\n"
     ]
    }
   ],
   "source": [
    "print(len(m.states))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# for nashape, seg in enumerate(m.states):\n",
    "#     print(seg)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>城市</th>\n",
       "      <th>经度</th>\n",
       "      <th>纬度</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>北京</th>\n",
       "      <td>北京</td>\n",
       "      <td>116.28</td>\n",
       "      <td>39.54</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>天津</th>\n",
       "      <td>天津</td>\n",
       "      <td>117.10</td>\n",
       "      <td>39.10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>石家庄</th>\n",
       "      <td>石家庄</td>\n",
       "      <td>114.26</td>\n",
       "      <td>38.03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>保定</th>\n",
       "      <td>保定</td>\n",
       "      <td>115.28</td>\n",
       "      <td>38.53</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>唐山</th>\n",
       "      <td>唐山</td>\n",
       "      <td>118.09</td>\n",
       "      <td>39.37</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>秦皇岛</th>\n",
       "      <td>秦皇岛</td>\n",
       "      <td>119.37</td>\n",
       "      <td>39.54</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>张家口</th>\n",
       "      <td>张家口</td>\n",
       "      <td>114.55</td>\n",
       "      <td>40.51</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>承德</th>\n",
       "      <td>承德</td>\n",
       "      <td>117.52</td>\n",
       "      <td>40.59</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>太原</th>\n",
       "      <td>太原</td>\n",
       "      <td>112.33</td>\n",
       "      <td>37.51</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>大同</th>\n",
       "      <td>大同</td>\n",
       "      <td>113.13</td>\n",
       "      <td>40.07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>临汾</th>\n",
       "      <td>临汾</td>\n",
       "      <td>111.31</td>\n",
       "      <td>36.05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>长治</th>\n",
       "      <td>长治</td>\n",
       "      <td>113.13</td>\n",
       "      <td>36.05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>呼和浩特</th>\n",
       "      <td>呼和浩特</td>\n",
       "      <td>111.38</td>\n",
       "      <td>40.48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>包头</th>\n",
       "      <td>包头</td>\n",
       "      <td>110.00</td>\n",
       "      <td>40.35</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>海拉尔</th>\n",
       "      <td>海拉尔</td>\n",
       "      <td>119.43</td>\n",
       "      <td>49.14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>沈阳</th>\n",
       "      <td>沈阳</td>\n",
       "      <td>123.23</td>\n",
       "      <td>41.48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>大连</th>\n",
       "      <td>大连</td>\n",
       "      <td>121.38</td>\n",
       "      <td>38.54</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>鞍山</th>\n",
       "      <td>鞍山</td>\n",
       "      <td>123.00</td>\n",
       "      <td>41.04</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>锦州</th>\n",
       "      <td>锦州</td>\n",
       "      <td>121.09</td>\n",
       "      <td>41.09</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>长春</th>\n",
       "      <td>长春</td>\n",
       "      <td>125.18</td>\n",
       "      <td>43.55</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>吉林</th>\n",
       "      <td>吉林</td>\n",
       "      <td>126.36</td>\n",
       "      <td>43.48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>哈尔滨</th>\n",
       "      <td>哈尔滨</td>\n",
       "      <td>126.38</td>\n",
       "      <td>45.45</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>齐齐哈尔</th>\n",
       "      <td>齐齐哈尔</td>\n",
       "      <td>123.55</td>\n",
       "      <td>47.22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>牡丹江</th>\n",
       "      <td>牡丹江</td>\n",
       "      <td>129.36</td>\n",
       "      <td>44.35</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>上海</th>\n",
       "      <td>上海</td>\n",
       "      <td>121.26</td>\n",
       "      <td>31.12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>南京</th>\n",
       "      <td>南京</td>\n",
       "      <td>118.46</td>\n",
       "      <td>32.03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>无锡</th>\n",
       "      <td>无锡</td>\n",
       "      <td>120.18</td>\n",
       "      <td>31.35</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>苏州</th>\n",
       "      <td>苏州</td>\n",
       "      <td>120.39</td>\n",
       "      <td>31.20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>徐州</th>\n",
       "      <td>徐州</td>\n",
       "      <td>117.12</td>\n",
       "      <td>34.16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>杭州</th>\n",
       "      <td>杭州</td>\n",
       "      <td>120.10</td>\n",
       "      <td>30.15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>汕头</th>\n",
       "      <td>汕头</td>\n",
       "      <td>116.40</td>\n",
       "      <td>23.21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>韶关</th>\n",
       "      <td>韶关</td>\n",
       "      <td>113.33</td>\n",
       "      <td>24.48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>海口</th>\n",
       "      <td>海口</td>\n",
       "      <td>110.10</td>\n",
       "      <td>20.03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>南宁</th>\n",
       "      <td>南宁</td>\n",
       "      <td>108.21</td>\n",
       "      <td>22.47</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>桂林</th>\n",
       "      <td>桂林</td>\n",
       "      <td>110.10</td>\n",
       "      <td>25.18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>柳州</th>\n",
       "      <td>柳州</td>\n",
       "      <td>109.19</td>\n",
       "      <td>24.20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>悟州</th>\n",
       "      <td>悟州</td>\n",
       "      <td>111.18</td>\n",
       "      <td>23.28</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>成都</th>\n",
       "      <td>成都</td>\n",
       "      <td>104.04</td>\n",
       "      <td>30.39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>重庆</th>\n",
       "      <td>重庆</td>\n",
       "      <td>106.33</td>\n",
       "      <td>29.33</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>内江</th>\n",
       "      <td>内江</td>\n",
       "      <td>105.03</td>\n",
       "      <td>29.35</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>泸州</th>\n",
       "      <td>泸州</td>\n",
       "      <td>105.27</td>\n",
       "      <td>28.54</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>万县</th>\n",
       "      <td>万县</td>\n",
       "      <td>108.22</td>\n",
       "      <td>30.48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>贵阳</th>\n",
       "      <td>贵阳</td>\n",
       "      <td>106.43</td>\n",
       "      <td>26.34</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>遵义</th>\n",
       "      <td>遵义</td>\n",
       "      <td>106.53</td>\n",
       "      <td>27.45</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>昆明</th>\n",
       "      <td>昆明</td>\n",
       "      <td>102.42</td>\n",
       "      <td>25.03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>拉萨</th>\n",
       "      <td>拉萨</td>\n",
       "      <td>91.02</td>\n",
       "      <td>29.39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日喀则</th>\n",
       "      <td>日喀则</td>\n",
       "      <td>88.49</td>\n",
       "      <td>29.16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>西安</th>\n",
       "      <td>西安</td>\n",
       "      <td>108.55</td>\n",
       "      <td>34.15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>宝鸡</th>\n",
       "      <td>宝鸡</td>\n",
       "      <td>107.09</td>\n",
       "      <td>34.21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>延安</th>\n",
       "      <td>延安</td>\n",
       "      <td>109.26</td>\n",
       "      <td>36.35</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>兰州</th>\n",
       "      <td>兰州</td>\n",
       "      <td>103.50</td>\n",
       "      <td>36.03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>天水</th>\n",
       "      <td>天水</td>\n",
       "      <td>105.33</td>\n",
       "      <td>34.35</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>酒泉</th>\n",
       "      <td>酒泉</td>\n",
       "      <td>98.30</td>\n",
       "      <td>39.44</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>西宁</th>\n",
       "      <td>西宁</td>\n",
       "      <td>101.49</td>\n",
       "      <td>36.37</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>银川</th>\n",
       "      <td>银川</td>\n",
       "      <td>106.13</td>\n",
       "      <td>38.28</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>乌鲁木齐</th>\n",
       "      <td>乌鲁木齐</td>\n",
       "      <td>87.36</td>\n",
       "      <td>43.46</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>哈密</th>\n",
       "      <td>哈密</td>\n",
       "      <td>93.27</td>\n",
       "      <td>42.50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>喀什</th>\n",
       "      <td>喀什</td>\n",
       "      <td>75.59</td>\n",
       "      <td>39.27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>和田</th>\n",
       "      <td>和田</td>\n",
       "      <td>79.55</td>\n",
       "      <td>37.07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>台北</th>\n",
       "      <td>台北</td>\n",
       "      <td>121.31</td>\n",
       "      <td>25.02</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>88 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "        城市      经度     纬度\n",
       "北京      北京  116.28  39.54\n",
       "天津      天津  117.10  39.10\n",
       "石家庄    石家庄  114.26  38.03\n",
       "保定      保定  115.28  38.53\n",
       "唐山      唐山  118.09  39.37\n",
       "秦皇岛    秦皇岛  119.37  39.54\n",
       "张家口    张家口  114.55  40.51\n",
       "承德      承德  117.52  40.59\n",
       "太原      太原  112.33  37.51\n",
       "大同      大同  113.13  40.07\n",
       "临汾      临汾  111.31  36.05\n",
       "长治      长治  113.13  36.05\n",
       "呼和浩特  呼和浩特  111.38  40.48\n",
       "包头      包头  110.00  40.35\n",
       "海拉尔    海拉尔  119.43  49.14\n",
       "沈阳      沈阳  123.23  41.48\n",
       "大连      大连  121.38  38.54\n",
       "鞍山      鞍山  123.00  41.04\n",
       "锦州      锦州  121.09  41.09\n",
       "长春      长春  125.18  43.55\n",
       "吉林      吉林  126.36  43.48\n",
       "哈尔滨    哈尔滨  126.38  45.45\n",
       "齐齐哈尔  齐齐哈尔  123.55  47.22\n",
       "牡丹江    牡丹江  129.36  44.35\n",
       "上海      上海  121.26  31.12\n",
       "南京      南京  118.46  32.03\n",
       "无锡      无锡  120.18  31.35\n",
       "苏州      苏州  120.39  31.20\n",
       "徐州      徐州  117.12  34.16\n",
       "杭州      杭州  120.10  30.15\n",
       "...    ...     ...    ...\n",
       "汕头      汕头  116.40  23.21\n",
       "韶关      韶关  113.33  24.48\n",
       "海口      海口  110.10  20.03\n",
       "南宁      南宁  108.21  22.47\n",
       "桂林      桂林  110.10  25.18\n",
       "柳州      柳州  109.19  24.20\n",
       "悟州      悟州  111.18  23.28\n",
       "成都      成都  104.04  30.39\n",
       "重庆      重庆  106.33  29.33\n",
       "内江      内江  105.03  29.35\n",
       "泸州      泸州  105.27  28.54\n",
       "万县      万县  108.22  30.48\n",
       "贵阳      贵阳  106.43  26.34\n",
       "遵义      遵义  106.53  27.45\n",
       "昆明      昆明  102.42  25.03\n",
       "拉萨      拉萨   91.02  29.39\n",
       "日喀则    日喀则   88.49  29.16\n",
       "西安      西安  108.55  34.15\n",
       "宝鸡      宝鸡  107.09  34.21\n",
       "延安      延安  109.26  36.35\n",
       "兰州      兰州  103.50  36.03\n",
       "天水      天水  105.33  34.35\n",
       "酒泉      酒泉   98.30  39.44\n",
       "西宁      西宁  101.49  36.37\n",
       "银川      银川  106.13  38.28\n",
       "乌鲁木齐  乌鲁木齐   87.36  43.46\n",
       "哈密      哈密   93.27  42.50\n",
       "喀什      喀什   75.59  39.27\n",
       "和田      和田   79.55  37.07\n",
       "台北      台北  121.31  25.02\n",
       "\n",
       "[88 rows x 3 columns]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = [i.split(' ') for i in open('F:\\下载\\Chinacityll.txt').read().split('\\n')]\n",
    "df = pd.DataFrame(data)\n",
    "\n",
    "df1 = df[[0,1,2]]\n",
    "# new = pd.merge(left=df[[0,1,2]], right=df[[3,4,5]], how='outer')\n",
    "df1.index = df[0]\n",
    "df1.columns = ['城市','经度','纬度']\n",
    "df2 = df[[3,4,5]]\n",
    "df2.index = df[3]\n",
    "df2.columns = ['城市','经度','纬度']\n",
    "new = df1.append(df2)\n",
    "new.drop('城市', inplace=True)\n",
    "new['经度'] = new['经度'].str.split(':').str[0] + '.' + new['经度'].str.split(':').str[1]\n",
    "new['经度'] = new['经度'].str[:-1]\n",
    "new['经度'].astype(float)\n",
    "new['纬度'] = new['纬度'].str.split(':').str[0] + '.' + new['纬度'].str.split(':').str[1]\n",
    "new['纬度'] = new['纬度'].str[:-1]\n",
    "new['纬度'].astype(float)\n",
    "new.dropna(axis=0, inplace=True)\n",
    "new.to_csv(r'F:\\Chinacity.csv')\n",
    "new"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'm' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-5-581e8e69a001>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[0mx\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m[\u001b[0m\u001b[0mfloat\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mi\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mi\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mlist\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mnew\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'经度'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mvalues\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m      2\u001b[0m \u001b[0my\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m[\u001b[0m\u001b[0mfloat\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mi\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mi\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mlist\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mnew\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'纬度'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mvalues\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m----> 3\u001b[0;31m \u001b[0ma\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mb\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mm\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mx\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0my\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[0;31mNameError\u001b[0m: name 'm' is not defined"
     ]
    }
   ],
   "source": [
    "x = [float(i) for i in list(new['经度'].values)]\n",
    "y = [float(i) for i in list(new['纬度'].values)]\n",
    "a, b = m(x, y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 214,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "fig = plt.figure(figsize=(16, 12))\n",
    "m = Basemap(llcrnrlat=14, llcrnrlon=73, urcrnrlat=54, urcrnrlon=135, projection='lcc', lat_1=33, lat_2=45, lon_0=100)\n",
    "m.drawcoastlines(linewidth=1, color='k')\n",
    "m.drawcountries(linewidth=1.5, color='k')\n",
    "# m.fillcontinents(color='lightgray',zorder=0)\n",
    "# m.drawmapboundary()\n",
    "m.readshapefile(r'F:\\下载\\Compressed\\CHN_adm_shp\\1\\CHN_adm1', 'states', drawbounds=True, color='k')\n",
    "m.readshapefile(r'F:\\下载\\Compressed\\CHN_adm_shp\\1\\TWN_adm1', 'taiwan', drawbounds=True, color='k')\n",
    "m.scatter(a,b, marker='o', color='#FF5600')\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 210,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on method scatter in module mpl_toolkits.basemap:\n",
      "\n",
      "scatter(*args, **kwargs) method of mpl_toolkits.basemap.Basemap instance\n",
      "    Plot points with markers on the map\n",
      "    (see matplotlib.pyplot.scatter documentation).\n",
      "    \n",
      "    If ``latlon`` keyword is set to True, x,y are intrepreted as\n",
      "    longitude and latitude in degrees.  Data and longitudes are\n",
      "    automatically shifted to match map projection region for cylindrical\n",
      "    and pseudocylindrical projections, and x,y are transformed to map\n",
      "    projection coordinates. If ``latlon`` is False (default), x and y\n",
      "    are assumed to be map projection coordinates.\n",
      "    \n",
      "    Extra keyword ``ax`` can be used to override the default axes instance.\n",
      "    \n",
      "    Other \\**kwargs passed on to matplotlib.pyplot.scatter.\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(m.scatter)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 198,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# help(pd.concat)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import scipy as sp\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "x = np.linspace(-np.pi, np.pi, 1000)\n",
    "f = np.sqrt(1-(np.abs(x)-1)**2)\n",
    "g = np.arccos(1-np.abs(x))-3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "plt.plot(x,f, 'r')\n",
    "plt.plot(x, g, 'r')\n",
    "plt.show()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
